<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>{#moodlemedia.desc}</title>
    <script type="text/javascript">
        // Because there is no relative path to TinyMCE, we have to use JavaScript
        // to work out correct path from the .js files from TinyMCE. Only files
        // inside this plugin can be included with relative path (below).
        var editor_tinymce_include = function(path) {
            document.write('<script type="text/javascript" src="' +
                parent.tinyMCE.baseURL + '/' + path + '"></' + 'script>');
        };
        editor_tinymce_include('tiny_mce_popup.js');
        editor_tinymce_include('utils/validate.js');
        editor_tinymce_include('utils/form_utils.js');
        editor_tinymce_include('utils/editable_selects.js');

        var getFileBrowserHTML = function(id, target_form_element, type, prefix) {
            var option = prefix + "_" + type + "_browser_callback", cb, html;

            cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback"));

            if (!cb)
                return "";

            html = '<a class="moodlebutton" id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;">';
            html += '<span id="' + id + '">' + tinyMCEPopup.getLang('moodlemedia.browsemedia') + '</span>';
            html += '</a>';

            return html;
        }

    </script>
    <script type="text/javascript" src="js/media.js"></script>
    <link href="css/media.css" rel="stylesheet" type="text/css" />
</head>
<body style="display: none">
    <form onsubmit="insertMedia();return false;" action="#">
        <div class="panel_wrapper">
            <div id="general_panel" class="panel current">
                <input id="src" name="src" type="hidden" value="" class="mceFocus" onchange="generatePreview();" />
                <input id="filename" name="filename" type="hidden" value="" />
                <fieldset>
                    <legend>{#media_dlg.general}</legend>

                    <table align="center" border="0" cellpadding="4" cellspacing="0">
                        <tr align="center">
                            <td colspan='2' id="filebrowsercontainer">&nbsp;</td>
                        </tr>
                    </table>
                </fieldset>

                <fieldset>
                    <legend>{#media_dlg.preview}</legend>
                    <div id="prev"></div>
                </fieldset>
            </div>

        </div>

        <div class="mceActionPanel">
            <div style="float: left">
                <input type="submit" id="insert" name="insert" value="{#insert}" />
            </div>

            <div style="float: right">
                <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
            </div>
        </div>
    </form>
</body>
</html>
